<template>
	<view class="page-box">
		<view class="order-box" v-for="(item,index) in datalist" :key="index" @click="GoGoodDetail(item.goods_id)">
			<image class="img" :src="item.image"></image>
			<view class="right-box">
				<view class="text1">{{item.title}}</view>
				<view class="text2">月销：{{item.num}}</view>
				<view class="text3">￥{{item.price}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				datalist:''
			}
		},
		onLoad() {
			uni.showLoading({
				title:"加载中"
			})
			uniCloud.callFunction({
				name:'GetCollect',
				data:{	
				},
				success: (rest) => {
					uni.hideLoading()
					console.log('获取收藏成功',rest.result.data)
					this.datalist = rest.result.data
				},
				fail: (err) => {
					uni.hideLoading()
					console.log('获取收藏失败',err)
				}
			})
		},
		methods: {
			GoGoodDetail(id){
				console.log(id)
				uni.navigateTo({
					url:'/pages/goods/goods-detail'+`?id=${id}`
				})
				},
		}
	}
</script>

<style scoped lang="scss">
	.order-box{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		background-color: #FFFFFF;
		padding: 34rpx 60rpx;
		margin-bottom: 24rpx;
		}
	.img{
		width: 250rpx;
		height: 250rpx;
		display: inline-block;
		margin-right: 36rpx;
		border-radius: 12rpx;
		}
	.right-box{
		width: 400rpx;
		}
	.text1{
		font-size: 30rpx;
		font-weight: bold;
		line-height: 40rpx;
		color: #000000;
		opacity: 1;
		}
	.text2{
		font-size: 26rpx;
		font-weight: 400;
		line-height: 32rpx;
		color: #BCBCBC;
		opacity: 1;
		margin: 20rpx 0rpx;
		}
	.text3{
		font-size: 30rpx;
		font-weight: 600;
		line-height: 40rpx;
		color: #EA5B0C;
		opacity: 1;
		}	
</style>

